package publics.model;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.sun.org.apache.bcel.internal.generic.NEW;

@Entity
@Table(name="enterprise")
public class Enterprise {//企业基本信息

	private Integer id;//ID  int not null,
	private String user;//公司登陆账号    varchar(20) not null,
	private String password;//登录密码   varchar(20) not null
	private String name;//企业名称    varchar(40) not null
	private String delegateName;//法人代表   varchar(4) not null
	
	private String delegateId;//法人身份证   varchar(19) not null
	private Integer delegateEducation;//法人学历    int not null,
	private String delegatePhone;//法人电话    varchar(12) not null,
	private String financeCharger;//财务负责人    varchar(4) not null,
	private String controller;//实际控制人    varchar(4) not null,
	
	private String registerAddress;//注册地址   varchar(60) not null,
	private Date registerTime;//注册时间     datetime not null,
	private Integer registerCapital;//注册资本（万元）   int not null,
	
	private EnterpriseType enterpriseType;
//	private Integer type;//企业类型（性质）   int not null,
	private IndustryType industryType;
//	private Integer industry;//所属行业   int not null,
	
	private String introduction;//企业简介text not null
	private String license;//工商注册号(营业执照证号)char(15) not null,    
	private String delegateNumber;//机构代码证号(法人代码证)  char(10) not null,
	private String taxEntryId;//税务登记证号   char(15) not null,
	private String loanAccount;//贷款卡号（账号） varchar(22) not null,
	
	private String contactName;//联系人姓名   varchar(4) not null,
	private String contactPosition;//联系人职务    varchar(10)
	private String contactMobile;//联系电话     varchar(12) not null,
	private String telephone;//联系人固定电话    varchar(12),
	private String fax;//联系人传真    varchar(12),
	
	private String email;//联系人电子邮箱      varchar(30) not null,
	private String website;//企业网址    varchar(40),
	private String postAddress;//通信地址  varchar(60) not null,
	private String postCode;//邮政编码    char(6) not null,
	private Date atTime;//认证时间     datetime not null,
	//此字段 在审核数据的时候要存入该时间，即存储该表的时候
	
	private Right right;//权限级别   int not null,
	
	private Set<Application> applications = new HashSet<Application>();//贷款申请表
	private Set<EnterpriseBoard> enterpriseBoards = new HashSet<EnterpriseBoard>();//企业董事会
	private Set<EnterpriseProduct> enterpriseProducts = new HashSet<EnterpriseProduct>();//企业产品
	private Set<EnterpriseStockholder> enterpriseStockholders = new HashSet<EnterpriseStockholder>();//股东情况
	private Set<LoanCard> loanCards = new HashSet<LoanCard>();//企业贷款卡
	private Set<ProposeLawsuit> proposeLawsuits = new HashSet<ProposeLawsuit>();//申请人法律诉讼或仲裁
	private Set<Proposer> proposers = new HashSet<Proposer>();//申请人征信情况
	private Set<ProposerGuarantee> proposerGuarantees = new HashSet<ProposerGuarantee>();//申请人对外担保情况
	
	
    @Id
    @GeneratedValue
    @Column(name="Ent_id")
	public Integer getId() {
		return id;
	}
    @Column(name="Ent_user")
	public String getUser() {
		return user;
	}
    @Column(name="Ent_password")
	public String getPassword() {
		return password;
	}
    @Column(name="Ent_name")
	public String getName() {
		return name;
	}
    @Column(name="Ent_delegate_name")
	public String getDelegateName() {
		return delegateName;
	}
    @Column(name="Ent_delegate_id")
	public String getDelegateId() {
		return delegateId;
	}
    @Column(name="Ent_delegate_education")
	public Integer getDelegateEducation() {
		return delegateEducation;
	}
    @Column(name="Ent_delegate_phone")
	public String getDelegatePhone() {
		return delegatePhone;
	}
    @Column(name="Ent_finance_charger")
	public String getFinanceCharger() {
		return financeCharger;
	}
    @Column(name="Ent_controller")
	public String getController() {
		return controller;
	}
    @Column(name="Ent_register_address")
	public String getRegisterAddress() {
		return registerAddress;
	}
    @Column(name="Ent_register_time")
	public Date getRegisterTime() {
		return registerTime;
	}
    @Column(name="Ent_register_capital")
	public Integer getRegisterCapital() {
		return registerCapital;
	}
   /* @Column(name="Ent_type")
	public Integer getType() {
		return type;
	}*/
    @ManyToOne
    @JoinColumn(name="Ent_type",nullable=false)
	public EnterpriseType getEnterpriseType() {
		return enterpriseType;
	}


	@ManyToOne
	@JoinColumn(name="Ent_industry",nullable=false)
	public IndustryType getIndustryType() {
		return industryType;
	}

	/*@Column(name="Ent_industry")
	public Integer getIndustry() {
		return industry;
	}*/
    @Column(name="Ent_introduction")
	public String getIntroduction() {
		return introduction;
	}
    @Column(name="Ent_license")
	public String getLicense() {
		return license;
	}
    @Column(name="Ent_delegate_number")
	public String getDelegateNumber() {
		return delegateNumber;
	}
    @Column(name="Ent_tax_entry_id")
	public String getTaxEntryId() {
		return taxEntryId;
	}
    @Column(name="Ent_loan_account")
	public String getLoanAccount() {
		return loanAccount;
	}
    @Column(name="Ent_contact_name")
	public String getContactName() {
		return contactName;
	}
    @Column(name="Ent_contact_position")
	public String getContactPosition() {
		return contactPosition;
	}
    @Column(name="Ent_contact_mobile")
	public String getContactMobile() {
		return contactMobile;
	}
    @Column(name="Ent_telephone")
	public String getTelephone() {
		return telephone;
	}
    @Column(name="Ent_fax")
	public String getFax() {
		return fax;
	}
    @Column(name="Ent_email")
	public String getEmail() {
		return email;
	}
    @Column(name="Ent_website")
	public String getWebsite() {
		return website;
	}
    @Column(name="Ent_post_address")
	public String getPostAddress() {
		return postAddress;
	}
    @Column(name="Ent_post_code")
	public String getPostCode() {
		return postCode;
	}
    @Column(name="Ent_at_time")
	public Date getAtTime() {
		return atTime;
	}
    @ManyToOne
    @JoinColumn(name="Rig_id",nullable=false)
	public Right getRight() {
		return right;
	}
    
	@OneToMany(mappedBy="ent")
	public Set<Application> getApplications() {
		return applications;
	}
	@OneToMany(mappedBy="ent")
	public Set<EnterpriseBoard> getEnterpriseBoards() {
		return enterpriseBoards;
	}
	@OneToMany(mappedBy="ent")
	public Set<EnterpriseProduct> getEnterpriseProducts() {
		return enterpriseProducts;
	}
	@OneToMany(mappedBy="ent")
	public Set<EnterpriseStockholder> getEnterpriseStockholders() {
		return enterpriseStockholders;
	}
	@OneToMany(mappedBy="ent")
	public Set<LoanCard> getLoanCards() {
		return loanCards;
	}
	@OneToMany(mappedBy="ent")
	public Set<ProposeLawsuit> getProposeLawsuits() {
		return proposeLawsuits;
	}
	@OneToMany(mappedBy="ent")
	public Set<Proposer> getProposers() {
		return proposers;
	}
	@OneToMany(mappedBy="ent")
	public Set<ProposerGuarantee> getProposerGuarantees() {
		return proposerGuarantees;
	}
	
	
	
	
	public void setId(Integer id) {
		this.id = id;
	}
	public void setUser(String user) {
		this.user = user;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public void setName(String name) {
		this.name = name;
	}
	public void setDelegateName(String delegateName) {
		this.delegateName = delegateName;
	}
	public void setDelegateId(String delegateId) {
		this.delegateId = delegateId;
	}
	public void setDelegateEducation(Integer delegateEducation) {
		this.delegateEducation = delegateEducation;
	}
	public void setDelegatePhone(String delegatePhone) {
		this.delegatePhone = delegatePhone;
	}
	public void setFinanceCharger(String financeCharger) {
		this.financeCharger = financeCharger;
	}
	public void setController(String controller) {
		this.controller = controller;
	}
	public void setRegisterAddress(String registerAddress) {
		this.registerAddress = registerAddress;
	}
	public void setRegisterTime(Date registerTime) {
		this.registerTime = registerTime;
	}
	public void setRegisterCapital(Integer registerCapital) {
		this.registerCapital = registerCapital;
	}
/*	public void setType(Integer type) {
		this.type = type;
	}
	public void setIndustry(Integer industry) {
		this.industry = industry;
	}*/
	public void setEnterpriseType(EnterpriseType enterpriseType) {
		this.enterpriseType = enterpriseType;
	}
	public void setIndustryType(IndustryType industryType) {
		this.industryType = industryType;
	}
	public void setIntroduction(String introduction) {
		this.introduction = introduction;
	}
	public void setLicense(String license) {
		this.license = license;
	}
	public void setDelegateNumber(String delegateNumber) {
		this.delegateNumber = delegateNumber;
	}
	public void setTaxEntryId(String taxEntryId) {
		this.taxEntryId = taxEntryId;
	}
	public void setLoanAccount(String loanAccount) {
		this.loanAccount = loanAccount;
	}
	public void setContactName(String contactName) {
		this.contactName = contactName;
	}
	public void setContactPosition(String contactPosition) {
		this.contactPosition = contactPosition;
	}
	public void setContactMobile(String contactMobile) {
		this.contactMobile = contactMobile;
	}
	public void setTelephone(String telephone) {
		this.telephone = telephone;
	}
	public void setFax(String fax) {
		this.fax = fax;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public void setWebsite(String website) {
		this.website = website;
	}
	public void setPostAddress(String postAddress) {
		this.postAddress = postAddress;
	}
	public void setPostCode(String postCode) {
		this.postCode = postCode;
	}
	public void setAtTime(Date atTime) {
		this.atTime = atTime;
	}
	public void setRight(Right right) {
		this.right = right;
	}
	
	
	

	public void setApplications(Set<Application> applications) {
		this.applications = applications;
	}
	public void setEnterpriseBoards(Set<EnterpriseBoard> enterpriseBoards) {
		this.enterpriseBoards = enterpriseBoards;
	}
	public void setEnterpriseProducts(Set<EnterpriseProduct> enterpriseProducts) {
		this.enterpriseProducts = enterpriseProducts;
	}
	public void setEnterpriseStockholders(
			Set<EnterpriseStockholder> enterpriseStockholders) {
		this.enterpriseStockholders = enterpriseStockholders;
	}
	public void setLoanCards(Set<LoanCard> loanCards) {
		this.loanCards = loanCards;
	}
	public void setProposeLawsuits(Set<ProposeLawsuit> proposeLawsuits) {
		this.proposeLawsuits = proposeLawsuits;
	}
	public void setProposers(Set<Proposer> proposers) {
		this.proposers = proposers;
	}
	public void setProposerGuarantees(Set<ProposerGuarantee> proposerGuarantees) {
		this.proposerGuarantees = proposerGuarantees;
	}
	
	
	public Enterprise() {
		super();
	}
	
	public Enterprise(Integer id, String user, String password, String name,
			String delegateName, String delegateId, Integer delegateEducation,
			String delegatePhone, String financeCharger, String controller,
			String registerAddress, Date registerTime, Integer registerCapital,
			EnterpriseType enterpriseType, IndustryType industryType,
			String introduction, String license, String delegateNumber,
			String taxEntryId, String loanAccount, String contactName,
			String contactPosition, String contactMobile, String telephone,
			String fax, String email, String website, String postAddress,
			String postCode, Date atTime, Right right) {
		super();
		this.id = id;
		this.user = user;
		this.password = password;
		this.name = name;
		this.delegateName = delegateName;
		this.delegateId = delegateId;
		this.delegateEducation = delegateEducation;
		this.delegatePhone = delegatePhone;
		this.financeCharger = financeCharger;
		this.controller = controller;
		this.registerAddress = registerAddress;
		this.registerTime = registerTime;
		this.registerCapital = registerCapital;
		this.enterpriseType = enterpriseType;
		this.industryType = industryType;
		this.introduction = introduction;
		this.license = license;
		this.delegateNumber = delegateNumber;
		this.taxEntryId = taxEntryId;
		this.loanAccount = loanAccount;
		this.contactName = contactName;
		this.contactPosition = contactPosition;
		this.contactMobile = contactMobile;
		this.telephone = telephone;
		this.fax = fax;
		this.email = email;
		this.website = website;
		this.postAddress = postAddress;
		this.postCode = postCode;
		this.atTime = atTime;
		this.right = right;
	}
	
	
	public Enterprise(Integer id, String user, String password, String name,
			String delegateName, String delegateId, Integer delegateEducation,
			String delegatePhone, String financeCharger, String controller,
			String registerAddress, Date registerTime, Integer registerCapital,
			EnterpriseType enterpriseType, IndustryType industryType,
			String introduction, String license, String delegateNumber,
			String taxEntryId, String loanAccount, String contactName,
			String contactPosition, String contactMobile, String telephone,
			String fax, String email, String website, String postAddress,
			String postCode, Date atTime, Right right,
			Set<Application> applications,
			Set<EnterpriseBoard> enterpriseBoards,
			Set<EnterpriseProduct> enterpriseProducts,
			Set<EnterpriseStockholder> enterpriseStockholders,
			Set<LoanCard> loanCards, Set<ProposeLawsuit> proposeLawsuits,
			Set<Proposer> proposers, Set<ProposerGuarantee> proposerGuarantees) {
		super();
		this.id = id;
		this.user = user;
		this.password = password;
		this.name = name;
		this.delegateName = delegateName;
		this.delegateId = delegateId;
		this.delegateEducation = delegateEducation;
		this.delegatePhone = delegatePhone;
		this.financeCharger = financeCharger;
		this.controller = controller;
		this.registerAddress = registerAddress;
		this.registerTime = registerTime;
		this.registerCapital = registerCapital;
		this.enterpriseType = enterpriseType;
		this.industryType = industryType;
		this.introduction = introduction;
		this.license = license;
		this.delegateNumber = delegateNumber;
		this.taxEntryId = taxEntryId;
		this.loanAccount = loanAccount;
		this.contactName = contactName;
		this.contactPosition = contactPosition;
		this.contactMobile = contactMobile;
		this.telephone = telephone;
		this.fax = fax;
		this.email = email;
		this.website = website;
		this.postAddress = postAddress;
		this.postCode = postCode;
		this.atTime = atTime;
		this.right = right;
		this.applications = applications;
		this.enterpriseBoards = enterpriseBoards;
		this.enterpriseProducts = enterpriseProducts;
		this.enterpriseStockholders = enterpriseStockholders;
		this.loanCards = loanCards;
		this.proposeLawsuits = proposeLawsuits;
		this.proposers = proposers;
		this.proposerGuarantees = proposerGuarantees;
	}
	
	
	
	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "Enterprise [atTime=" + atTime + ", contactMobile="
				+ contactMobile + ", contactName=" + contactName
				+ ", contactPosition=" + contactPosition + ", controller="
				+ controller + ", delegateEducation=" + delegateEducation
				+ ", delegateId=" + delegateId + ", delegateName="
				+ delegateName + ", delegateNumber=" + delegateNumber
				+ ", delegatePhone=" + delegatePhone + ", email=" + email
				+ ", enterpriseType=" + enterpriseType + ", fax=" + fax
				+ ", financeCharger=" + financeCharger + ", id=" + id
				+ ", industryType=" + industryType + ", introduction="
				+ introduction + ", right=" + right + ", license=" + license
				+ ", loanAccount=" + loanAccount + ", name=" + name
				+ ", password=" + password + ", postAddress=" + postAddress
				+ ", postCode=" + postCode + ", registerAddress="
				+ registerAddress + ", registerCapital=" + registerCapital
				+ ", registerTime=" + registerTime + ", taxEntryId="
				+ taxEntryId + ", telephone=" + telephone + ", user=" + user
				+ ", website=" + website + "]";
	}
	
	
	
}
